Skip to content

feat(agent): connect DeepSeek and Kimi keys and a Kimi Code plan - #453

Merged
kgoedecke merged 2 commits into
mainfrom
feat/deepseek-kimi-keys
Nov 9, 2026
Merged

kgoedecke merged 2 commits into
mainfrom
feat/deepseek-kimi-keys

Conversation

@kgoedecke

@kgoedecke kgoedecke commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Native BYOK for DeepSeek and Kimi (Moonshot), asked for by a Discord user who uses their DeepSeek key in every other AI tool. Until now both were only reachable through OpenRouter.

What changes

  • Two new model account kinds, deepseek-key and kimi-key. They run on the existing Chat Completions transport (server/chatCompletionsAgent.ts) against fixed URLs: https://api.deepseek.com/chat/completions and https://api.moonshot.ai/v1/chat/completions. As with the other providers, users can't supply an endpoint (SSRF). Operators can override DEEPSEEK_CHAT_URL / KIMI_CHAT_URL, for example to point Kimi at api.moonshot.cn for China-platform keys.
  • Curated rosters in shared/modelMenu.ts, like OpenRouter's. The model picker only accepts roster ids, and an off-roster env override runs text-only.
    • DeepSeek: deepseek-flash (V4.1 Flash, vision, the default) and deepseek-v4-pro (marked text-only until its image input is confirmed).
    • Kimi: kimi-k3.1-pro (the default), kimi-k3.1-pro-highspeed and kimi-k3, all with vision.
  • Kimi Code plan (kimi-code): runs on a Kimi membership (Plus and up) instead of per-token billing. Members paste a key from the Kimi Code console (Moonshot offers no OAuth). It has its own endpoint (api.kimi.ai/coding/v1, override KIMI_CODE_CHAT_URL) and its own model ids (k3.1-pro, k3.1-pro-highspeed, k3). Requests send User-Agent: Doop/<version>, because Kimi Code's terms require third-party tools to identify themselves truthfully. DeepSeek has no subscription equivalent; its API is pay-per-token only.
  • Reasoning round-trip. Both APIs return reasoning_content and answer 400 to a tool-calling conversation that leaves it out of an earlier assistant turn. The transport now keeps the reasoning as a thinking block in the run's history (TurnBlock widened accordingly). It sends that reasoning back only for configs with echoReasoning, so OpenRouter and Gemini requests are unchanged. A response that contains only reasoning still fails as empty.
  • The deepseek-key / kimi-key kinds are added to the model-account plumbing: modelAccounts (key shape sk-…, roster policy, vision), agentModel routing (now a per-kind config table), agentRunners menus and the connect routes.
  • Settings → Doop Agent gets two key rows, with deepseek / kimi BrandMark and AppIcon marks (Lobe Icons paths, MIT) and en / pt-BR strings. README, .env.example and .context docs are updated.

Tests

  • chatCompletionsAgent.test.ts: the fixed endpoints and auth, no temperature sent (Kimi rejects any value but its own), reasoning kept as a thinking block, echoed only when the flag is set, a full two-turn DeepSeek round-trip, and a thinking-only response still failing.
  • rosterRouting.test.ts: routing, labels and vision flags for both kinds, including the text-only Pro and an off-roster id.
  • providerKeyAccounts.test.ts: key-shape validation, roster-only model picks, and keys never echoed back.
  • Typecheck, lint, format:check and doc-lint pass locally. The full vitest run was still going when this PR opened; CI runs it in shards.

Not verified against the live APIs

  • I haven't run any of the three with a real key. Model ids and capabilities come from api-docs.deepseek.com and platform.kimi.ai/docs as of today. Worth one smoke run per provider before release, especially whether deepseek-v4-pro accepts images (if it does, flip vision to true) and whether the Kimi Code ids see images the way the platform's K3 tiers do.

🤖 Generated with Claude Code

Adds `deepseek-key` and `kimi-key` model accounts on the Chat Completions
transport, each against a fixed endpoint with a curated roster and vision
flags. Both providers refuse a tool-calling conversation that drops an
earlier turn's reasoning_content, so the transport now keeps it as a
thinking block in the run's history and sends it back for them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were found.

Summary

Adds native DeepSeek and Kimi key connections through the existing Chat Completions transport.

  • People can connect DeepSeek and Kimi keys for Doop Agent runs.
  • DeepSeek and Kimi keep their reasoning across tool calls.

kgoedecke explicitly keeps deepseek-v4-pro text-only until image support is confirmed. kgoedecke also states that neither provider has been tested with a live key.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Settings: connect key] --> B[Store model account]
  B --> C[Pick account and curated model]
  C --> D[Chat Completions transport]
  D --> E[DeepSeek or Moonshot fixed endpoint]
  E --> F[Answer, reasoning, and tool calls]
  F --> G[Keep full assistant turn]
  G --> D
Loading

Reviews (1) · Last reviewed commit: "feat(agent): connect DeepSeek and Kimi A..." · Reviewed by Greptile

A Kimi membership's Kimi Code key, billed to the membership: its own
endpoint and ids, sent with a Doop User-Agent as Kimi Code's terms ask
of third-party tools. Also fixes a test tuple type tsgo rejected.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@kgoedecke kgoedecke changed the title feat(agent): connect DeepSeek and Kimi API keys feat(agent): connect DeepSeek and Kimi keys and a Kimi Code plan Nov 9, 2026
@kgoedecke
kgoedecke merged commit f4278e2 into main Nov 9, 2026
10 checks passed
kgoedecke added a commit that referenced this pull request Nov 16, 2026
search_logos' keyless fallback handed agents DuckDuckGo .ico URLs, which
sharp cannot decode. A small decoder now reads the icon's largest entry,
PNG or bitmap, with its transparency; the favicon is converted to PNG and
stored as a Doop asset (one per domain per process), so frames hold a plain
image on our own origin. When an open-source vector mark exists and the
only brand hit is a favicon, the vector marks come first and the favicon is
labelled as one, in both the MCP tool and the resident agent.

(cherry picked from commit b42dc426a05555e4a40f81eb452ba963f4c6cbbe, without
the Figma and Canva export paths, which OSS does not ship)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 2bfe8f4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant